package com.zhuiyun.pm.client.home.controller;

import com.zhuiyun.pm.client.home.service.MyBidService;
import com.zhuiyun.pm.client.order.entity.ClientOrder;
import com.zhuiyun.pm.page.PageRequest;
import com.zhuiyun.pm.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO 我的竞价
 * @ClassName MyBidController
 * @Author HH
 * @Date 2023/3/23 16:25
 **/
@RestController
@CrossOrigin
@RequestMapping("/myBid")
public class MyBidController {

    @Autowired
    MyBidService myBidService;

    /**
    * @Description 查询我的竞价
    * @Author HH
    * @Date 2023/3/24 10:00
    * @Return com.zhuiyun.pm.result.CommonResult
    * @param userId
    * @param pageRequest
    */
    @GetMapping("/selectMyBidById")
    public CommonResult selectMyBidById(Integer userId, PageRequest pageRequest) {
        return myBidService.selectMyBidById(userId, pageRequest);
    }

    /**
    * @Description 查询我的订单
    * @Author HH
    * @Date 2023/3/24 13:42
    * @Return com.zhuiyun.pm.result.CommonResult
    * @param bidder
    * @param pageRequest
    */
    @GetMapping("/selectMyOrderById")
    public CommonResult selectMyOrderById(Integer bidder, PageRequest pageRequest) {
        return myBidService.selectMyOrderById(bidder, pageRequest);
    }

    /**
     * @Description 根据订单id修改订单状态
     * @Author HH
     * @Date 2023/3/24 16:05
     * @Return int
     * @param clientOrder
     */
    @PostMapping("/updateMyOrderById")
    public CommonResult updateMyOrderById(@RequestBody ClientOrder clientOrder){
        return myBidService.updateMyOrderById(clientOrder);
    }

}
